package com.zhw.cloud;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;

/**
 * Spring cloud有两种服务调用方式，一种是Ribbon+restTemplate,另一种是feign
 * Ribbon是一个负载均衡客户端，可以很好的控制htt和tcp的一些行为。Feign默认集成了ribbon。
 * 
 * 本项目演示：Feign
 * pom.xml文件添加依赖 ：spring-cloud-starter-eureka、spring-cloud-starter-feign、spring-boot-starter-web
 * 
 * 
 * @EnableDiscoveryClient 通过此注解向服务中心注册
 * @EnableFeignClients 此注解代表使用feign
 * @EnableHystrixDashboard 代表开启Hystrix的仪表盘 ,pom.xml中添加相应的依赖。 浏览器访问url--> http://localhost:9095/hystrix
 * @author hongwei.zhang
 */
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@EnableHystrixDashboard
public class CloudFeign1Application {

	public static void main(String[] args) {
		SpringApplication.run(CloudFeign1Application.class, args);
	}
}
